const dayjs = require('dayjs')
const relativeTime = require('dayjs/plugin/relativeTime')
require('dayjs/locale/zh-cn')

dayjs.locale('zh-cn')
dayjs.extend(relativeTime)

export function transformId(old: string) {
  return old.replace(/\//g, '-')
}

export function restoreId(id: string) {
  return id.replace(/-/g, '/')
}

export function toRelativeTime(old: string) {
  return dayjs().to(dayjs(old))

}